<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>微信菜单管理</title>
	<script src="../js/config.js"></script>
</head>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>wx</title>
	<link rel="stylesheet" type="text/css" href="../css/style.css">
	<link rel="stylesheet" type="text/css" href="../js/layer/theme/default/layer.css">
	<script type="text/javascript" src="../js/vue.js"></script>
	<script type="text/javascript" src="../js/filter.js"></script>
	<script type="text/javascript" src="../js/config.js"></script>
	<link href="../images/favicon.ico" rel="icon" type="image/x-icon" />
	<script type="text/javascript" src="../js/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="../js/jquery.serializejson.js"></script>
	<script type="text/javascript" src="../js/layer/layer.js"></script>
</head>
<body>
<div class="crm-content" id="menuList">
	<a onclick="newWxMenu()"  class="add-button opr-url">新增微信菜单</a>
	<a onclick="syncWxMenu()"  class="add-button opr-url">同步微信菜单</a>
	<a href="../menu/menu_list.html"  class="add-button">微信菜单管理</a>
	<a href="../material/material_list.html"  class="add-button">微信素材管理</a>
	<a href="../keyword/keyword_list.html"  class="add-button">微信关键字管理</a>
	<table class="list-box" v-for="(re,index) in res">
		<tr>
			<th colspan="5">
				<h3>节点:{{re.menuName}}({{re.children.length}})</h3>
				<span class="over-small" style="float:right" v-bind:data-wxMenuId="re.menuId" v-bind:class="'fnode'+re.menuId" onclick="toggleChild(this)">-</span>
			</th>
		</tr>
		<tr>
			<th>菜单名称</th>
			<th>菜单类型</th>
			<th>父节点</th>
			<th>菜单关键字/url</th>
			<th>操作</th>
		</tr>
		<tr>
			<td width="20%">{{re.menuName}}</td>
			<td width="20%">{{re.menuType | filterSetMenuType}}</td>
			<td width="20%">无</td>
			<td width="20%">无</td>
			<td width="20%">
				<span class="over-small" v-bind:data-wxMenuId="re.menuId" v-bind:data-wxMenuParentId="re.menuParentId"  v-bind:data-wxMenuType="re.menuType" onclick="editWxMenu(this)">编辑</span>
				<span class="over-small" v-bind:data-wxMenuId="re.menuId"  onclick="removeWxMenu(this)">删除</span>
			</td>
		</tr>
		<tr  v-bind:class="'child'+re.menuId" v-for="(child,index) in re.children">
			<td>{{child.menuName}}</td>
			<td>{{child.menuType | filterSetMenuType}}</td>
			<td>{{re.menuName}}</td>
			<td>{{child.menuKey}}{{child.menuUrl}}</td>
			<td>
				<span class="over-small" v-bind:data-wxMenuId="child.menuId"  v-bind:data-wxMenuType="child.menuType"   v-bind:data-wxMenuParentId="child.menuParentId"  onclick="editWxMenu(this)">编辑</span>
				<span class="over-small" v-bind:data-wxMenuId="child.menuId"  onclick="removeWxMenu(this)">删除</span>
			</td>
		</tr>
	</table>









<!-- 新增微信菜单弹窗  -->
<form class="cell-content" id="addWxMenuForm" style="display: none;" >
	<div class="cell">
		<label><span class="red">*</span>菜单名称</label>
		<input type="text" name="menuName" id="menuName">
	</div>
	<div class="cell" v-if="canMode">
		<label><span class="red">*</span>是否主菜单</label>
		<div class="group-radio"><input type="radio" name="menuMode"  v-model="modeMenu" value="1"  onclick="checkFnode(this)"><span>是</span></div>
		<div class="group-radio"><input type="radio" name="menuMode"  v-model="modeMenu" value="0"  onclick="checkFnode(this)"><span>否</span></div>
	</div>
	<div class="cell">
		<label><span class="red">*</span>菜单类别</label>
		<select name="menuType" onchange="setMenuNode(this)">
			<option value="master" v-if="is_fnode">这是一个父节点</option>
			<option v-for="menuType in menuTypeList" v-bind:value="menuType.value">{{menuType.name}}</option>
		</select>
	</div>
	<div class="cell" v-if="is_show">
		<label><span class="red">*</span>菜单上一级</label>
		<select name="menuParentId" >
			<option value="" v-if="is_fnode">请选择</option>
			<option v-for="wxType in wxTypeList" v-bind:value="wxType.menuId" >{{wxType.menuName}}</option>
		</select>
	</div>
	<div class="cell" v-if='nodeType == "view"'>
		<label><span class="red">*</span>菜单Url</label>
		<input type="text" name="menuUrl" id="menuUrl" class="textInfo" onchange="checkHttpCorrect(this)">
	</div>
	<div class="cell" v-if='nodeType == "click"'>
		<label><span class="red">*</span>菜单关键字</label>
		<input type="text" name="menuKey" id="menuKey" class="textInfo">
	</div>
	<div class="cell" v-if='nodeType == "media"'>
		<label><span class="red">*</span>media</label>
		<input type="text" name="mediaId" id="mediaId" class="textInfo">
	</div>
	<div class="cell">
		<label><span class="red">*</span>序号</label>
		<input type="number" name="menuSeq" id="menuSeq" class="textInfo">
	</div>
</form>

<!-- 修改微信菜单弹窗  -->
<form class="cell-content" id="updateWxMenuForm" style="display: none;" >
	<div class="cell">
		<label><span class="red">*</span>菜单名称</label>
		<input type="text" name="menuName" id="menuName"  v-model="wxRes.menuName">
	</div>
	<div class="cell" v-if="canMode">
		<label><span class="red">*</span>是否主菜单</label>
		<div class="group-radio"><input type="radio" name="menuMode"  v-model="modeMenu" value="1"  onclick="checkFnode(this)"><span>是</span></div>
		<div class="group-radio"><input type="radio" name="menuMode"  v-model="modeMenu" value="0"  onclick="checkFnode(this)"><span>否</span></div>
	</div>
	<div class="cell">
		<label><span class="red">*</span>菜单类别</label>
		<select name="menuType" v-model="wxRes.menuType" >
			<option value="master" v-if="is_fnode">这是一个父节点</option>
			<option v-for="menuType in menuTypeList" v-bind:value="menuType.value">{{menuType.name}}</option>
		</select>
	</div>
	<div class="cell" v-if="is_show">
		<label><span class="red">*</span>菜单上一级</label>
		<select name="menuParentId" v-model="wxRes.menuParentId">
			<option value="" v-if="is_fnode">请选择</option>
			<option v-for="wxType in wxTypeList" v-bind:value="wxType.menuId">{{wxType.menuName}}</option>
		</select>
	</div>
	<div class="cell" v-if='nodeType == "view"'>
		<label><span class="red">*</span>菜单Url</label>
		<input type="text" name="menuUrl" id="menuUrl"  v-model="wxRes.menuUrl"  class="textInfo" onchange="checkHttpCorrect(this)" >
	</div>
	<div class="cell" v-if='nodeType == "click"'>
		<label><span class="red">*</span>菜单关键字</label>
		<input type="text" name="menuKey" id="menuKey"  v-model="wxRes.menuKey" class="textInfo">
	</div>
	<div class="cell" v-if='nodeType == "media"'>
		<label><span class="red">*</span>media</label>
		<input type="text" name="mediaId" id="mediaId"  v-model="wxRes.menuId" class="textInfo">
	</div>
	<div class="cell">
		<label><span class="red">*</span>序号</label>
		<input type="numer" name="menuSeq" id="menuSeq"  v-model="wxRes.menuSeq">
	</div>
</form>

</div>



	<script type="text/javascript">
        var wxMenuList = new Vue({
            el:'#menuList',
            data: {
                is_fnode: true,
                is_maxNode: true,
                res:[],
                menuTypeList:[],
                wxTypeList:[],
				nodeType: 'view',
				is_show: true,
                wxRes: [],
				modeMenu: 1,
				canMode: true
            },
            methods: {

            },
        })

		function toggleChild(ele){
			var _this = $(ele);
			var menuId = _this.attr("data-wxMenuId")
			$(".child"+menuId).toggle();
            _this.text(_this.text()=="-" ? "+": "-");
		}
	</script>
	<script type="text/javascript" src="../js/wxMenu.js"></script>

</body>
</html>
























